package ${(introspectedTable.tableConfiguration.properties.fileDirectoryApiImpl)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryApiImpl)?index_of("/src/main/java/")+15))?replace("/",".")};

import com.broker.framework.common.pojo.CommonResult;

import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;

/***
 * ---------------------------
 * @Description: 表备注：${introspectedTable.remarks!}<#--deal null-->
 * 针对表【${introspectedTable.tableConfiguration.schema!}.${introspectedTable.fullyQualifiedTable.introspectedTableName}】的Api实现类
 * ---------------------------
 * @author: ${introspectedTable.tableConfiguration.properties.auther!}
 * @date: ${introspectedTable.tableConfiguration.properties.createTime!}
 * @version: v1.0
 * ---------------------------
 */
@RestController
public class ${className}ApiImpl implements ${className}Api {

    @Resource
    private ${className}Service ${classNameTuoFeng}Service;


    @Override
    public CommonResult<${className}DTO> get(Long id) {
        ${className}DO DO = ${classNameTuoFeng}Service.get(id);
        return CommonResult.success(${className}Convert.INSTANCE.convertToDTO(DO));
    }

<#list introspectedTable.nonPrimaryKeyColumns as baseColumns>
        <#if baseColumns.actualColumnName?last_index_of("_id")!=-1 && baseColumns.actualColumnName !="tenant_id">
    @Override
    public CommonResult<List<${className}DTO>> getBy${baseColumns.javaProperty?cap_first}(${baseColumns.fullyQualifiedJavaType.shortNameWithoutTypeArguments} ${baseColumns.javaProperty}) {
        return CommonResult.success(${classNameTuoFeng}Service.getBy${baseColumns.javaProperty?cap_first}(${baseColumns.javaProperty}));
    }
        </#if>
</#list>

}